<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台首页</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/4.4.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/admin/js/layui/css/layui.css">
    <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
    <style>
        *{touch-action: none;}
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-2">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right">今天</span>
                    <h5>入库量</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins">{:db('express')->whereBetweenTime('create_time', date('Y-m-d'))->where('status', 0)->count()}</h1>
                    <div class="stat-percent font-bold text-navy"></div>
                    <small></small>
                </div>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right">今天</span>
                    <h5>出库量</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins">{:db('express')->whereBetweenTime('update_time', date('Y-m-d'))->where('status', 1)->count()}</h1>
                    <div class="stat-percent font-bold text-danger"></div>
                    <small></small>
                </div>
            </div>
        </div>
        <!-- <div class="col-sm-2">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right">待处理</span>
                    <h5>提现申请</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins">{:db('withdraw')->where('status', 0)->count()}</h1>
                    <div class="stat-percent font-bold text-danger"></div>
                    <small></small>
                </div>
            </div>
        </div> -->
        <div class="col-sm-2">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right">待处理</span>
                    <h5>寄件订单</h5>
                </div>
                <a href="{:url('order/index')}">
                    <div class="ibox-content">
                        <h1 class="no-margins">{:db('order')->where('orde_status', 0)->count()}</h1>
                        <div class="stat-percent font-bold text-danger"></div>
                        <small></small>
                    </div>
                </a>
            </div>
        </div>

        <div class="col-sm-2">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right">待处理</span>
                    <h5>送件订单</h5>
                </div>
                <a href="{:url('sendorder/index')}">
                    <div class="ibox-content">
                        <h1 class="no-margins">{:db('send_order')->where('send_status', 0)->count()}</h1>
                        <div class="stat-percent font-bold text-danger"></div>
                        <small></small>
                    </div>
                </a>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right">待处理</span>
                    <h5>认证申请</h5>
                </div>
                <a href="{:url('member/index')}">
                    <div class="ibox-content">
                        <h1 class="no-margins">{:db('member')->where('memb_is_truth', 2)->count()}</h1>
                        <div class="stat-percent font-bold text-danger"></div>
                        <small></small>
                    </div>
                </a>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-primary pull-right">待处理</span>
                    <h5>投诉</h5>
                </div>
                <a href="{:url('complaint/index')}">
                    <div class="ibox-content">
                        <h1 class="no-margins">{:db('complaint')->where('status', 0)->count()}</h1>
                        <div class="stat-percent font-bold text-danger"></div>
                        <small></small>
                    </div>
                </a>
            </div>
        </div>
    </div>

    <!-- <div class="row">
        
    </div> -->

    <div class="row">
        <div class="col-sm-8">
            <div class="ibox float-e-margins">
                <div class="row" style="margin-left: 0px; margin-right: 0px;">
                    <div class="ibox-title" style="min-height: 70px">
                        <div class="col-sm-2">
                            <h3 style="line-height:35px">数据分析</h3>
                        </div>
                        <form class="layui-form">
                            <div class="col-sm-8">
                                <div class="layui-form-item" style="margin-bottom: 0px;">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">时间段</label>
                                        <div class="layui-input-inline" style="width: 150px">
                                            <input type="text" id="start" name="startTime" required  lay-verify="required" placeholder="开始时间" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">-</div>
                                        <div class="layui-input-inline" style="width: 150px">
                                            <input type="text" id="end" name="endTime" required  lay-verify="required" placeholder="结束时间" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <div class="layui-form-item" style="margin-bottom: 0px;">
                                    <div class="layui-input-inline">
                                        <button class="layui-btn" lay-submit lay-filter="search">查询</button>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="ibox-content no-padding">
                    <div class="row ibox-content" id="main" style="margin-left: 0px; margin-right: 0px;">
                        <div class="col-sm-3">
                            <div class="alert alert-info">
                                <h3 class="kuaidi">中通：<span code='ZTO'>{:model('ExpressModel')->getCount('ZTO')}</span></h3>
                            </div>
                            <div class="alert alert-info">
                                <h3 class="kuaidi">韵达：<span code='YUNDA'>{:model('ExpressModel')->getCount('YUNDA')}</span></h3>
                            </div>
                            <div class="alert alert-info">
                                <h3 class="kuaidi">顺丰：<span code='SF'>{:model('ExpressModel')->getCount('SF')}</span></h3>
                            </div>
                        </div>
                        <div class="col-sm-3 col-sm-offset-1">
                            <div class="alert alert-info">
                                <h3 class="kuaidi">圆通：<span code='YTO'>{:model('ExpressModel')->getCount('YTO')}</span></h3>
                            </div>
                            <div class="alert alert-info">
                                <h3 class="kuaidi">汇通：<span code="HTO">{:model('ExpressModel')->getCount('HTO')}</span></h3>
                            </div>
                            <div class="alert alert-info">
                                <h3 class="kuaidi">EMS：<span code="EMS">{:model('ExpressModel')->getCount('EMS')}</span></h3>
                            </div>
                        </div>
                        <div class="col-sm-3 col-sm-offset-1">
                            <div class="alert alert-info">
                                <h3 class="kuaidi">申通：<span code="STO">{:model('ExpressModel')->getCount('STO')}</span></h3>
                            </div>
                            <div class="alert alert-info">
                                <h3 class="kuaidi">邮政：<span code="ChinaPost">{:model('ExpressModel')->getCount('ChinaPost')}</span></h3>
                            </div>
                            <div class="alert alert-info">
                                <h3 class="kuaidi">总共：<span code="total">{:model('ExpressModel')->count()}件</span></h3>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>系统信息</h5>
                </div>
                <div class="ibox-content">
                    <div class="alert alert-info">
                        <h2>{:date('Y-m-d H:i:s')}</h2>
                    </div>
                    <div class="alert alert-info">
                        <h2>星期{:config('app.week')[date('w')]}</h2>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="/static/admin/js/layui/layui.js"></script>
<script>
    layui.use(['laydate', 'form'], function(){
        var laydate = layui.laydate,
        form = layui.form;
        laydate.render({
            elem: '#start',
        });
        laydate.render({
            elem: '#end',
        });
        form.on('submit(search)', function(data){
            $.post('search', {time: data.field}, function(res){
                layer.msg(res.msg);
                if(res.code === 1){
                    dom = $('h3.kuaidi span');
                    dom.each(function(k){
                        if(res.data[$(this).attr('code')] == undefined)
                            $(this).text(0);
                        else
                            $(this).text(res.data[$(this).attr('code')]);
                    });
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
